
class Solution {
    func isPalindrome(_ x: Int) -> Bool {
        if x < 0 || x % 10 == 0{
            return x == 0 ? true : false
        }
        let numStr = String(x)
        for index in 0...(numStr.count / 2) {
            let startIndex = numStr.index(numStr.startIndex, offsetBy: index)
            let endIndex = numStr.index(numStr.startIndex, offsetBy: (numStr.count - index - 1))
            if numStr[startIndex] != numStr[endIndex] {
                return false
            }
        }
        return true
        
    }
}
